package com.example.demo1.controller;

import com.example.demo1.Entity.Role;
import com.example.demo1.Entity.Status;
import com.example.demo1.Entity.User_table;
import com.example.demo1.service.User_table_service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
public class User_table_controller {
    @Autowired
    private User_table_service userTableService;

    @PostMapping("/SetUser")
    public void inputAndSaveUser_table(@RequestParam String username,
                                       @RequestParam String password,
                                       @RequestParam Role role
    ) {
        System.out.println(username);
        System.out.println(password);
        System.out.println(role);
        User_table user_table = userTableService.UserTableSet(username, password, role, Status.enabled);
        userTableService.save_data(user_table);
    }
}